<!doctype html>
<html>
    <head>
        <title>AudioTrack.enabled change</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
            </head>
    <body>
        <script>
            async_test(function(t)
            {
                var audio = document.createElement("audio");
                audio.src = "../content/test.oga";

                audio.onloadedmetadata = t.step_func(function()
                {
                    assert_equals(audio.audioTracks.length, 1, "audioTracks.length");
                    assert_true(audio.audioTracks[0].enabled, "audioTrack.enabled (initial)");
                    audio.audioTracks[0].enabled = false;
                    assert_false(audio.audioTracks[0].enabled, "audioTrack.enabled (first setter)");

                    audio.audioTracks.onchange = t.step_func(function()
                    {
                        assert_false(audio.audioTracks[0].enabled, "audioTrack.enabled (first change event)");
                        audio.audioTracks[0].enabled = true;
                        assert_true(audio.audioTracks[0].enabled, "audioTrack.enabled (second setter)");

                        audio.audioTracks.onchange = t.step_func_done(function()
                        {
                            assert_true(audio.audioTracks[0].enabled, "audioTrack.enabled (second change event)");
                        });
                    });
                });
            }, "AudioTrack.enabled = false");
        </script>
    </body>
</html>
